#include "../head.h"

class Fraction
{
public:
    Fraction(int num, int den = 1)
    : m_numerator(num), m_denominator(den) {}
    // 转换函数
    operator double() const
    {
        return double(m_numerator)/double(m_denominator);
    }
private:
    int m_numerator;
    int m_denominator;
};

int main()
{
    Fraction obj(3, 5);
    double f = 2.0+obj;
    double g = obj+3;
    cout << f << endl;
    cout << g << endl;
}